<template>
  <el-form
    :ref="jobRef(item.name)"
    :model="neekWorksForm.jobPostDetailDtoList[Number(item.name)]"
    :rules="neekWorksFormRules"
    label-width="auto"
    class="demo-neekWorksForm"
    :size="formSize"
    status-icon
    label-position="top"
  >
    <el-row :gutter="24">
      <el-col :span="12">
        <el-form-item label="岗位名称" prop="jobName">
          <el-input
            v-model="
              neekWorksForm.jobPostDetailDtoList[Number(item.name)].jobName
            "
            placeholder="请输入岗位名称"
            type="textarea"
            :autosize="{ minRows: 1, maxRows: 2 }"
            maxlength="100"
            show-word-limit
          />
        </el-form-item>
      </el-col>
      <el-col :span="12">
        <el-form-item label="招聘类型" prop="recruitmentType">
          <el-select
            v-model="
              neekWorksForm.jobPostDetailDtoList[Number(item.name)]
                .recruitmentType
            "
            clearable
            placeholder="添加招聘类型"
          >
            <el-option
              v-for="item in sys_recruitment_type"
              :key="item.value"
              :label="item.label"
              :value="Number(item.value)"
            />
          </el-select>
        </el-form-item>
      </el-col>
    </el-row>
    <el-row :gutter="24">
      <el-col :span="12">
        <el-form-item label="职级" prop="positionLevel">
          <el-input
            v-model="
              neekWorksForm.jobPostDetailDtoList[Number(item.name)]
                .positionLevel
            "
            placeholder="请输入职级"
          />
        </el-form-item>
      </el-col>
      <el-col :span="12">
        <el-form-item label="薪酬范围" prop="salaryRange">
          <el-input
            v-model="
              neekWorksForm.jobPostDetailDtoList[Number(item.name)].salaryRange
            "
            placeholder="请输入薪酬范围"
            type="textarea"
            :autosize="{ minRows: 1, maxRows: 1 }"
            maxlength="50"
            show-word-limit
          />
        </el-form-item>
      </el-col>
    </el-row>
    <!-- 工作年限  学历 -->
    <el-row :gutter="24">
      <el-col :span="24">
        <el-form-item label="岗位职责" prop="jobResponsibilities">
          <el-input
            v-model="
              neekWorksForm.jobPostDetailDtoList[Number(item.name)]
                .jobResponsibilities
            "
            type="textarea"
            :rows="4"
            maxlength="1000"
            show-word-limit
            style="width: 90%"
            placeholder="请输入岗位职责"
          />
          <el-tooltip
            placement="right"
            trigger="click"
            popper-class="successTip"
          >
            <template #content>
              <div class="tooltipText">
                <div class="textOne">已规避岗位不清晰的用工风险！</div>
                <div class="textTwo">
                  如果用人单位没有制定明确的录用条件，那么很有可能
                </div>
                <div class="textTwo">
                  会对日后以“员工在试用期间被证明不符合录用条件”
                </div>
                <div class="textTwo">为由解除劳动合同带来麻烦。</div>
              </div>
            </template>

            <el-button type="success" round class="btn"
              ><el-icon><Select /></el-icon
            ></el-button>
          </el-tooltip>
        </el-form-item>
      </el-col>
    </el-row>
    <el-row :gutter="24">
      <el-col :span="24">
        <el-form-item label="任职条件" prop="qualification">
          <el-input
            v-model="
              neekWorksForm.jobPostDetailDtoList[Number(item.name)]
                .qualification
            "
            type="textarea"
            :rows="4"
            maxlength="1000"
            show-word-limit
            style="width: 90%"
            placeholder="请输入任职条件"
          />
          <el-tooltip
            placement="right"
            trigger="click"
            popper-class="warningTip"
          >
            <template #content>
              <div class="tooltipText">
                <div class="textTwo">
                  招聘简章或广告中常见的歧视性内容包括：民族歧视、
                </div>
                <div class="textTwo">
                  种族歧视、性别歧视、农村劳动者、残疾人和传染病病
                </div>
                <div class="textTwo">
                  原携带者等。用人单位在招聘过程中不要在招聘简章或
                </div>
                <div class="textTwo">
                  广告中出现法律禁止的相关歧视性内容，用人单位依法
                </div>
                <div class="textTwo">
                  享有用人自主权，但应当向劳动者提供平等的就业机会，
                </div>
                <div class="textTwo">不要发布歧视性的招聘信息。</div>
              </div>
            </template>
            <el-button type="warning" round class="btn"
              ><span style="font-size: 21px">!</span></el-button
            >
          </el-tooltip>
        </el-form-item>
      </el-col>
    </el-row>
    <el-row :gutter="24">
      <el-col :span="24">
        <el-form-item label="岗位关键词" prop="jobKeywords">
          <el-input
            v-model="
              neekWorksForm.jobPostDetailDtoList[Number(item.name)].jobKeywords
            "
            :rows="4"
            type="textarea"
            maxlength="1000"
            show-word-limit
            placeholder="请输入岗位关键词"
          />
        </el-form-item>
      </el-col>
    </el-row>
    <el-row :gutter="24">
      <el-col :span="24">
        <el-form-item label="岗位信息描述文件" prop="file">
          <Upload
            v-model:modelValue="
              neekWorksForm.jobPostDetailDtoList[Number(item.name)].file
            "
            :isShowTip="false"
            :fileType="fileType"
            @update:modelValue="uploadFiles"
          ></Upload>
        </el-form-item>
      </el-col>
    </el-row>
    <el-row :gutter="24">
      <el-col :span="12">
        <el-form-item label="需求人数" prop="requirePersonNumber">
          <el-input
            v-model="
              neekWorksForm.jobPostDetailDtoList[Number(item.name)]
                .requirePersonNumber
            "
            maxlength="1000"
            show-word-limit
            placeholder="请输入需求人数"
          />
        </el-form-item>
      </el-col>
      <el-col :span="12">
        <el-form-item label="需求紧急程度" prop="requireEmergencyLevel">
          <div
            class="tags"
            :class="
              neekWorksForm.jobPostDetailDtoList[Number(item.name)]
                .requireEmergencyLevel == 0
                ? 'primaryTag'
                : 'normalTag'
            "
            @click="onChange1"
          >
            <el-button
              v-if="false"
              v-model="
                neekWorksForm.jobPostDetailDtoList[Number(item.name)]
                  .requireEmergencyLevel
              "
            ></el-button
            >一般
          </div>
          <div
            class="tags"
            :class="
              neekWorksForm.jobPostDetailDtoList[Number(item.name)]
                .requireEmergencyLevel == 1
                ? 'warningTag'
                : 'normalTag'
            "
            @click="onChange2"
          >
            <el-button
              v-if="false"
              v-model="
                neekWorksForm.jobPostDetailDtoList[Number(item.name)]
                  .requireEmergencyLevel
              "
            ></el-button
            >紧急
          </div>
          <div
            class="tags"
            :class="
              neekWorksForm.jobPostDetailDtoList[Number(item.name)]
                .requireEmergencyLevel == 2
                ? 'dangerTag'
                : 'normalTag'
            "
            @click="onChange3"
          >
            <el-button
              v-if="false"
              v-model="
                neekWorksForm.jobPostDetailDtoList[Number(item.name)]
                  .requireEmergencyLevel
              "
            ></el-button
            >非常紧急
          </div>
        </el-form-item>
      </el-col>
    </el-row>
    <el-row :gutter="24">
      <el-col :span="12">
        <el-form-item label="期望到岗日期" prop="hopeArrivalTime">
          <el-date-picker
            v-model="
              neekWorksForm.jobPostDetailDtoList[Number(item.name)]
                .hopeArrivalTime
            "
            type="date"
            placeholder="年/月/日"
          />
        </el-form-item>
      </el-col>
      <el-col :span="12">
        <el-form-item label="截止日期" prop="closeTime">
          <el-date-picker
            v-model="
              neekWorksForm.jobPostDetailDtoList[Number(item.name)].closeTime
            "
            type="date"
            placeholder="年/月/日"
          />
        </el-form-item>
      </el-col>
    </el-row>
    <!-- *期望面试方式	手工选择，下拉框，选项值：线上，线下，线上或线下，必填。
              *工作地点	手工选择，下拉框，省市区三级联动，必填。支持添加多个工作地点 -->
    <!-- <el-row :gutter="24">
                      <el-col :span="12">
                        <el-form-item label="期望面试方式" prop="hopeInterviewMethod">
                          <el-select
                            v-model="
                              neekWorksForm.jobPostDetailDtoList[Number(item.name)].hopeInterviewMethod
                            "
                            clearable
                            placeholder="期望面试方式"
                          >
                            <el-option
                              v-for="item in hopeInterviewMethodoptions"
                              :key="item.value"
                              :label="item.label"
                              :value="Number(item.value)"
                            />
                          </el-select>
                        </el-form-item>
                      </el-col>
                    </el-row> -->
    <!-- 备注	手工填写，文本框，100字，非必填。提示语：“如果该岗位需要不同职级的人员，您在此可以备注。例：高级1人，紧急，中级1人，一般，初级2人一般。”。 -->
    <el-row :gutter="24">
      <el-col :span="6">
        <el-form-item label="是否是特殊岗位">
          <div v-for="(ele, index) in sys_is_special" :key="index">
            <div
              style="
                display: flex;
                align-items: center;
                justify-content: center;
              "
            >
              <div
                :class="
                  neekWorksForm.jobPostDetailDtoList[Number(item.name)]
                    .isSpecialPosition == ele.value
                    ? 'radios'
                    : 'noradios'
                "
                @click="changeRadios(ele.value)"
              ></div>
              <div
                class="isNo"
                :class="ele.value == 0 ? 'isColor' : 'noColor'"
                @click="changeRadios(ele.value)"
              >
                <div>
                  {{ ele.label }}
                </div>
              </div>
            </div>
          </div>
        </el-form-item>
      </el-col>
    </el-row>
    <!-- *岗位资格证明要求	如果是否是特殊岗位选择：是，则出现此字段并手工填写，文本域，1000字，必填。 -->
  </el-form>
</template>

<script setup>
const props = defineProps({
  jobData: Object,
  index: Number,
  sysRecruitmentType: Array,
});

const emit = defineEmits(["emergency-change", "radio-change"]);

// 紧急程度切换
const handleEmergencyChange = (level) => {
  emit("emergency-change", level);
};
</script>
<style scoped></style>
